package com.wthink.hzgj.util

import android.app.Activity
import androidx.fragment.app.Fragment

//设置屏幕的透明度
fun Fragment.setBackgroundAlpha(alpha: Float) {
    val lp = activity?.getWindow()?.getAttributes()
    lp?.let {
        lp.alpha = alpha
        activity!!.getWindow().setAttributes(lp)
    }
}

fun Activity.setBackgroundAlpha(alpha: Float) {
    val lp = getWindow()?.getAttributes()
    lp?.let {
        lp.alpha = alpha
        getWindow().setAttributes(lp)
    }
}